<?php
namespace app\admin\controller;

use app\BaseController;
use think\exception\ValidateException;

class Base extends BaseController{

    protected $admin = null;
    protected $notCheckTokenAction = [];

    public function initialize() {
        $this->admin = session(config("admin.session_user"));

        $action = $this->request->action();
        if (!in_array($action, $this->notCheckTokenAction)) {
            $check = $this->request->checkToken('__token__');
            if(false === $check) {
                throw new ValidateException('invalid token');
            }
        }
    }
}